let t = require;
let e = module
let o = e.exports;
o.default = e.exports;

'use strict';
console.log("start");
var _n36,
    i =
        (this && this.__extends) ||
        ((_n36 = function n(t, e) {
            return (_n36 =
                Object.setPrototypeOf ||
                ({
                    __proto__: []
                }
                    instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) {
                        Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                    }
                })(t, e);
        }),
            function (t, e) {
                function o() {
                    this.constructor = t;
                }
                _n36(t, e),
                    (t.prototype =
                        null === e ?
                            Object.create(e) :
                            ((o.prototype = e.prototype), new o()));
            }),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var i,
                r = arguments.length,
                a =
                    r < 3 ?
                        e :
                        null === n ?
                            (n = Object.getOwnPropertyDescriptor(e, o)) :
                            n;
            if (
                'object' ==
                (typeof Reflect === 'undefined' ?
                    'undefined' :
                    typeof (Reflect)) &&
                'function' == typeof Reflect.decorate
            )
                a = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--) {
                    (i = t[s]) &&
                        (a = (r < 3 ? i(a) : r > 3 ? i(e, o, a) : i(e, o)) || a);
                }
            return r > 3 && a && Object.defineProperty(e, o, a), a;
        };
Object.defineProperty(o, '__esModule', {
    value: !0
}),
    (o.BattlePanel = void 0);
var a = t('UIPanel'),
    s = t('UIViewRes'),
    c = t('UILayer'),
    l = t('MergePanel'),
    u = t('ScenePanel'),
    h = t('UIMrg'),
    p = t('BattleResultPanel'),
    f = t('PlayerMrg'),
    d = t('SoundMrg'),
    g = t('BattleResultVo'),
    _ = t('ChapterRoundCfg'),
    y = t('UmaSdkHelper'),
    C = t('BattleMrg'),
    m = t('ConstantCfg'),
    v = t('ComUtils'),
    b = t('LangCfg'),
    M = cc._decorator,
    I = M.ccclass,
    A =
        (M.property,
            (function (t) {
                function e() {
                    return (null !== t && t.apply(this, arguments)) || this;
                }
                return (
                    i(e, t),
                    (e.prototype.onInit = function () {
                        t.prototype.onInit.call(this),
                            (this._merge = new l.MergePanel(
                                this.view.getChildByName('merge')
                            )),
                            this._merge.on(
                                C.BattleEvent.StartBattle,
                                this.onStartBattleHandler,
                                this
                            ),
                            this.addCom(this._merge),
                            (this._scene = new u.ScenePanel(
                                this.view.getChildByName('battle')
                            )),
                            this._scene.on(
                                C.BattleEvent.BattleOver,
                                this.onBattleOverHandler,
                                this
                            ),
                            this.addCom(this._scene);
                    }),
                    (e.prototype.onShow = function () {
                        t.prototype.onShow.call(this),
                            (this._chapter = this.getData()),
                            (this._round = _.ChapterRoundCfg.ins.getDataByRound(
                                this._chapter.id,
                                1
                            )),
                            (C.BattleMrg.ins.money = this._round.step),
                            (C.BattleMrg.ins.eradicateItem = 0),
                            (C.BattleMrg.ins.swapItem = 0),
                            (this._merge.chapter = this._chapter),
                            this._merge.ready(this._round),
                            (this._scene.chapter = this._chapter),
                            this._scene.setGrid(this._merge.grids),
                            this._scene.setMoneyCom(this._merge.getMoneyCom()),
                            this._scene.ready(this._round),
                            d.SoundMrg.battleMusic(),
                            this._view.getComponent("BattleViewScene").startScene();
                    }),
                    (e.prototype.onLang = function () {
                        var t = v.default.getComponent(
                            cc.Label,
                            this.view,
                            'battle/ui/txtRound'
                        );
                        (t.string = b.LangCfg.ins.getContent(201200)),
                            ((t = v.default.getComponent(
                                cc.Label,
                                this.view,
                                'merge/bottom/buttons/btnRemove/Background/New Label'
                            )).string = b.LangCfg.ins.getContent(201201)),
                            ((t = v.default.getComponent(
                                cc.Label,
                                this.view,
                                'merge/bottom/buttons/btnSwap/Background/New Label'
                            )).string = b.LangCfg.ins.getContent(201203)),
                            ((t = v.default.getComponent(
                                cc.Label,
                                this.view,
                                'merge/bottom/buttons/btnRefresh/Background/New Label'
                            )).string = b.LangCfg.ins.getContent(201205)),
                            ((t = v.default.getComponent(
                                cc.Label,
                                this.view,
                                'merge/bottom/buttons/btnBattle/Background/New Label'
                            )).string = b.LangCfg.ins.getContent(201206)),
                            ((t = v.default.getComponent(
                                cc.Label,
                                this.view,
                                'merge/card/txtBuffTitle'
                            )).string = b.LangCfg.ins.getContent(201207));
                    }),
                    (e.prototype.onClose = function () {
                        t.prototype.onClose.call(this);
                    }),
                    (e.prototype.getItemCom = function (t) {
                        return this._merge.getItemCom(t);
                    }),
                    (e.prototype.getGridCom = function (t, e) {
                        return this._merge.getGridCom(t, e);
                    }),
                    (e.prototype.getBattleScope = function () {
                        return this._scene.getScope();
                    }),
                    (e.prototype.getBattleButton = function () {
                        return this._merge.getBattleButton();
                    }),
                    (e.prototype.getRefreshButton = function () {
                        return this._merge.getRefreshButton();
                    }),
                    (e.prototype.getSwapButton = function () {
                        return this._merge.getSwapButton();
                    }),
                    (e.prototype.getRemoveButton = function () {
                        return this._merge.getRemoveButton();
                    }),
                    (e.prototype.refresh = function () {
                        this._scene.ready(this._round),
                            this._merge.ready(this._round);
                    }),
                    (e.prototype.canShowWeakGuide = function () {
                        return this._merge.canShowWeakGuide;
                    }),
                    (e.prototype.onStartBattleHandler = function () {
                        this._scene.startBattle();
                    }),
                    (e.prototype.onBattleOverHandler = function (t) {
                        this.delayCall(
                            1,
                            function () {
                                this.battleOver(t);
                            }.bind(this)
                        );
                    }),
                    (e.prototype.battleOver = function (t) {
                        t
                            ?
                            (y.default.roundWin(this._chapter.id, this._round.round),
                                this.nextRound(),
                                this._round ?
                                    this.refresh() :
                                    (h.UIMrg.show(
                                        p.BattleResultPanel,
                                        new g.BattleResultVo(!0, this._chapter)
                                    ),
                                        1 == this._chapter.type &&
                                        (y.default.chapterPass(this._chapter.id),
                                            this._chapter.id == f.PlayerMrg.ins.chapter.id &&
                                            (this._chapter.id >=
                                                m.ConstantCfg.ins.getValue(15) &&
                                                f.PlayerMrg.ins.guideComplete(2),
                                                f.PlayerMrg.ins.nextChapter())),
                                        f.PlayerMrg.ins.firstRound())) :
                            (h.UIMrg.show(
                                p.BattleResultPanel,
                                new g.BattleResultVo(!1, this._chapter)
                            ),
                                f.PlayerMrg.ins.firstRound(),
                                y.default.roundLose(this._chapter.id, this._round.round));
                    }),
                    (e.prototype.nextRound = function () {
                        f.PlayerMrg.ins.nextRound(this._round, this._chapter.type),
                            (this._round = _.ChapterRoundCfg.ins.getDataByRound(
                                this._chapter.id,
                                this._round.round + 1
                            ));
                    }),
                    (e.RES = new s.UIViewRes(
                        'BattleView',
                        'Battle',
                        c.UILayer.MainLayer
                    )),
                    r([I('BattlePanel')], e)
                );
            })(a.default));
(o.BattlePanel = A), console.log("end");
module.exports = e.exports;